package com.zhuzi;

import cn.hutool.core.io.FileUtil;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

/**
 * @author zhuzi
 * 2022/9/13 15:47
 */
public class FileUtils {
    @Test
    public void fileSizeTest() throws IOException {
        long size = FileUtil.size(new File("/Users/zhuzi/Desktop/头像.png"));
        System.out.println(size / 1024 / 1024);

        
        long siezFile = Files.size(Paths.get("/Users/zhuzi/Desktop/头像.png"));
        System.out.println(siezFile);
    }
}
